import { defineStore } from "pinia";
import { ref } from 'vue'
// define store
export const useUserStore = defineStore('user',()=>{
    // member info
    const profile = ref<any>()

    // save member info, to be used in login
    const setProfile = (val:any)=>{
        profile.value = val
    }
    //  clear member info, to be used in exist
    const clearProfile = ()=>{
        profile.value=undefined
    }
    
    return {
        profile,
        setProfile,
        clearProfile,
    }
},
// persist  
{ 
    persist: {
        storage:{
            getItem(key){
                return uni.getStorageSync(key);
            },
            setItem(key,value){
                uni.setStorageSync(key,value)
            }
        }
    }
})